This is experiment replicates the original RIC protocol from Castello et al. (2012) with the following changes:
Custom Functions
jwrangle.importMixedFiles( )
I generally import everything I MIGHT use at the start and set up pathing using the OS-agnostic pathlib.
#### File utilities
import os
import pandas as pd
from pathlib import Path
from imp import reload
#### Data Wrangling
import copy
import numpy as np
#### RBP Suite Modules
import jwrangle
import jvis
import jinspect
import jtest
import jweb
#### Sequence Tools
from Bio import SeqIO
#### Graphical Packages
import upsetplot as upset
import seaborn as sns
import matplotlib.pyplot as plt
import altair as alt
#### define working directories
cwd = Path(os.getcwd())
base_path = Path(os.path.join(*cwd.parts[:cwd.parts.index('experiments')]))
#### MaxQuant proteinGroups & evidence files
MQ_folder = jwrangle.importMixedFiles(cwd / 'MaxQuant')
MQ_folder.keys()
pGroups = MQ_folder['proteinGroups.txt']
evidence = MQ_folder['evidence.txt']
#### Inspect MQ setup
MQ_folder['parameters.txt'].head(9)
Custom Functions
jwrangle.MQ_writeMetadata( )
Metadata tabulates the test conditions for ALL experiments that shared the same MQ search and thuss all experiments that comprise the MQ outputs. Metadata can also be done in a spreadsheet program. Here, I have created my metadata programmatically instead (I simply find this easier).
The metadata table gives users the opportunity to rename samples and define the experimental parameters for the data. This task can be expecially complex for MaxQuant because a unified output is generated even if distinctly separate experiments are searched as a batch and with different parameters applied.
The function jwrangle.MQ_writeMetadata( ) will take a metadata table, rename all samples in the proteinGroups and evidence files, assign alternative filenames, and save new copies to be used in future analyses.
#### Inspect column names
colnames = list(pGroups.columns.values)
#### View experiment names as a list
experiment_names = []
for i in colnames:
if 'Intensity ' in i:
experiment_names.append(i.replace('Intensity ', ''))
#### I want to assign new names....
new_expt_names = ['nCL_OdT_A', 'nCL_OdT_B', 'nCL_OdT_C', 'nCL_OdT_D', 'nCL_OdT_E', 'nCL_OdT_F',
'254_OdT_A', '254_OdT_B', '254_OdT_C', '254_OdT_D', '254_OdT_E', '254_OdT_F']
#### Assign condition identifiers
condition = []
for i in new_expt_names:
condition.append(i[:3])
#### Create a list of associated replicate identifiers
replicate = []
for i in experiment_names:
replicate.append(i[-1])
#### The MQ_groups dictionary assigns each condition to its MQ group parameter
MQ_groups = {'RIC-OdT':['nCL','254']}
#### We then use the condition list to create an MQ_groups list
Grp_parameters = []
for label in condition:
for key, value in MQ_groups.items():
if label in value:
Grp_parameters.append(key)
exp_df = pd.DataFrame(
{'experiment': experiment_names,
'condition': condition,
'replicate': replicate,
'sample':new_expt_names,
'measure':['Intensity']*len(new_expt_names), # adding this column allows our metadata file to be compatible with Proteus
'MQgroups':Grp_parameters
})
exp_df
MQ_expt299 = jwrangle.MQ_writeMetadata(pGroups, evidence, exp_df, 'e299', cwd)
Functions
jweb.mapAnyID( )
jwrangle.importMixedFiles( )
MaxQuant does a good job of assigning a Gene name to each protein group. Presumably these gene names come from the FASTA. However:
To avoid these problems we will remap the Majority protein IDs to ENTREZ gene IDs. jweb.mapAnyID( ) will retrieve all possible genes for each protein group, and will also select a primary ID to singularly represent the group by a consistent method. This is a very flexible function, see help( ) for further explanation. From this point, the MQ 'Gene names' column will no longer be necessary. This function can also handle ID mapping to and from almost any convention.
Ensuring our proteins have a consistent gene naming strategy is essential for inter-experiment comparison and the later use of set methods. It also creates a standard that can be applied for accurately mapping RNA-Seq results and thus aid in future mapping of protein-RNA partners.
#### If not already loaded, read in the metadata-adjusted files
metadata = pd.read_csv(cwd / 'metadata' / 'e299_metadata.csv', index_col = 0)
pGroups = pd.read_csv(cwd / 'MaxQuant' / 'e299_proteinGroups_metalabeled.txt', delimiter = '\t')
evidence = pd.read_csv(cwd / 'MaxQuant' / 'e299_evidence_metalabeled.txt', delimiter = '\t')
# #### Dynamically remap gene names in our proteinGroups file and save a copy
# pGroups_remap = jweb.mapAnyID_gPro(pGroups['Majority protein IDs'].tolist(), splitstr = [';', '-'], geneProductType = 'protein',
# gConvertOrganism = 'hsapiens', gConvertTarget = 'ENTREZGENE', writetopath = [cwd, 'pGroups_remap'], writeTargetsAsList = 'NO')
#### If not already loaded, read in the remapped proteinGroups file
pGroups_remap = jwrangle.importMixedFiles(cwd / 'downloads' / 'pGroups_remap', dropSuffix = 'yes')
pGroups_remap.keys()
#### jwrangle.importMixedFiles() returns a dictionary where keys = files. We want the 'id_map' table created by jweb.mapAnyID_gPro().
#### We'll rename the Query column and drop duplicates so the table can be merged with our proteinGroups table.
id_map = pGroups_remap['id_map'].rename(columns={'Query': 'Majority protein IDs'}).drop_duplicates()
id_map.head(2)
#### Now use merge to add these new columns to our proteinGroups table
pGroups_map = pd.merge(pGroups, id_map, on='Majority protein IDs', how='left')
#### Check the tables are merged by viewing column elements from each.
pGroups_map[id_map.columns.tolist() + ['Peptide IDs']].head(2)
Functions
jinspect.MQ_getContaminants( )
MQ_getContaminants_sbplot( )
jwrangle.importMixedFiles( )
We can extract the conaminants from our proteinGroups file using jinspect.MQ_getContaminants( ). These extracted table will return log2(iBAQ values).
Contaminants can then be reviewed with _MQ_getContaminantssbplot( ).
#### Extract contaminants
contaminants = jinspect.MQ_getContaminants(pGroups_map, metadata)
contaminants.head(2)
#### Sort the metadata into a more intuitive order
metadata_sort = metadata.sort_values(by = ['experiment'])
#### Visually inspect contaminants
jvis.MQ_getContaminants_sbplot(contaminants, metadata_sort, width = 1, length = 1.5, layout = 'individual')
Wow thats a ton of rubbish in there!
Functions
jinspect.MQ_getMissedCleavages( )
jvis.CommonPalettesAsHex
jvis.BarPlotByGroup_sbplot( )
Assessing missed cleavages is an essential metric for understanding the quality of the tryptic digestion. This data is recorded in the evidence file.
_jinspect.MQgetMissedCleavages( ) will return a long form data table that can easily be used for plotting.
The dictionary jvis.CommonPalettesAsHex contains a number of palettes that are common to both matplotlib and ggplot (from R). These are provided to ensure consistency is easy to achieve across both languages.
We'll plot the missed cleavages with the generic function jvis.BarPlotByGroup_sbplot( )
#### Extract the missed cleavage data into a long form table for plotting
MissedCleavages = jinspect.MQ_getMissedCleavages(evidence, metadata_sort, drop_contaminants = True)
### Select a colour palette
cpal = jvis.CommonPalettesAsHex
set2_paired = []
for i in cpal['Set2_qual']:
set2_paired.append(i)
set2_paired.append(i)
#### Plot the grouped data points
sns.set_style('whitegrid')
jvis.BarPlotByGroup_sbplot(MissedCleavages, x_col = 'group', y_col = '% Missed Cleavages', title = '% Missed Cleavages', pal = set2_paired)
Digestion efficiency isn't great. Let's reduce the digestion volume by 0.5x and maintain the same trypsin concentration in future experiments
Functions
jwrangle.MQ_getThreePassFilter( )
SeqIO.parse( )
After QC we no longer want the contaminants in our data. jwrangle.MQ_getThreePassFilter( ) will remove reverse peptides, contaminants, and only identified by site from MQ tables.
The filter will also accept customised exclusion lists in case users have added odd protein species to the search FASTA tables. In this particular experiment we added to the human FASTA, RNAse proteins and the large T antigen. The former as 1) a check that dynamic range is not being overwhelmed and 2) as an quantitative spike-in control to compare tryptic efficiency and the sample recovery across samples following C18 cleanup.
#### Map the location of the custom FASTA elements
os.listdir(base_path / 'my_resources' / 'FASTA')
#### Create a list of the non-human proteins that were added to the custom FASTA genome search.
new_cont = []
with open(base_path / 'my_resources' / 'FASTA' / "custom_proteome_elements.fasta", "r") as handle:
for record in SeqIO.parse(handle, "fasta"):
new_cont.append(record.id.split('|')[1])
#### Remove all unwanted contaminants and IDs from the proteinGroups table
pGroup_clean = jwrangle.MQ_getThreePassFilter(pGroups_map, custom_exclusion = new_cont)
#### Inspect the cleaned dataframe
pGroup_clean[['ENTREZGENE_gPro primary'] + [i for i in pGroup_clean.columns if 'iBAQ' in i]].head(2)
Functions
jinspect.MQ_dropDuplicateIDs( )
The next step focuses on improving confidence in the quality of our data. This is done by applying jinspect.MQ_dropDuplicateIDs( ) which has the below effects:
#### Drop duplicates and apply LFQ filter
filter_dict = jinspect.MQ_dropDuplicateIDs(pGroup_clean, metadata, prefix = 'Peptides', ID = 'ENTREZGENE_gPro primary', pool = 'measure', drop_ID = 'None',
keep_PoolCalcs = False, applyLFQ_filter = ['Intensity', 'iBAQ'])
#### The df_keep value contains our targets, df_droprows conatins the discarded duplicates. Assign the df_keep value to a new variable and inspect.
pGroup_filtered = filter_dict['df_keep']
pGroup_filtered.head(2)
Functions
jtest.getDistanceMatrix( )
jvis.MQ_showDendrogramQC_mplplot( )
A distance matrix function jtest.getDistanceMatrix( ) is provided for users who wish to apply different algorithms or create different visualisations.
I like the 'ward' method for distance calculations and using a dengrogram to confirm that clustering matches expectations and so use a prerolled function jvis.MQ_showDendrogramQC_mplplot( )
#### Confirm that clustering matches expectations
jvis.MQ_showDendrogramQC_mplplot(pGroup_filtered, 'LFQ intensity', metadata, 'QC clustering: ', grid = 'YES', fsize = (8, 5))
QC clustering is as expected.
Functions
jwrangle.Log2_ByPrefix( )
jwrangle.MQ_poolMulti( )
jvis.ViolinCompare_sbplot( )
Here we review normalisation effects on each sample within the condition groups; these are most easily interpreted after log2 transformation. We will transform all measures of interest with _jwrangle.Log2ByPrefix( ) and then pool all the values of interest, by condition, with _jwrangle.MQpoolMulti( ). The function _jvis.ViolinComparesbplot( ) will let use compare Intensity distribution on a per sample basis.
Normalisation is applied to LFQ values by MaxQuant and is a feature of its handling of label-free data. I've not seen a detailed explanation of how it works though so it is a leap of faith that Cox and Mann have selected an appropriate method.
Normalisation must be applied separately to nCL and cCL groups. This is unusual though necessary to avoid outrageous results caused by having groups with extreme differences. See expt.313 for evidence.
#### Log2 transform available intensity values.
pGroup_log2 = jwrangle.Log2_ByPrefix(pGroup_filtered, 'LFQ intensity')
pGroup_log2 = jwrangle.Log2_ByPrefix(pGroup_log2, 'iBAQ')
pGroup_log2 = jwrangle.Log2_ByPrefix(pGroup_log2, 'Intensity')
pGroup_log2.replace(0,np.nan, inplace=True)
#### Create a long form dataset for each desired grouping
pool_SampleIntensity = jwrangle.MQ_poolMulti(pGroup_log2, metadata_sort, melt_list = ['Intensity', 'LFQ intensity'], group = 'condition')
pool_SampleIntensity.keys()
#### Inspect the Intensity shifts generated by the LFQ normalisation algorithm. In MaxQuant Raw Intensity and iBAQ values are
#### not subjected to the LFQ normalisation calculations so this is a good way to spot any gross violations
sns.set_style('whitegrid')
jvis.ViolinCompare_sbplot(pool_SampleIntensity['nCL'], title = 'nCL: Normalisation Effects', ylabel = 'Log2(Intensity)', palette = ['#ff6666', '#99ccff'])
sns.set_style('whitegrid')
jvis.ViolinCompare_sbplot(pool_SampleIntensity['254'], title = '254nm cCL: Normalisation Effects', ylabel = 'Log2(Intensity)', palette = cpal['Set3_qual'])
We can see here the effect of normalisation where two groups with different protein levels are processed together for MaxQuant LFQ. This approach is conventional for affinity proteomics and is intended to use quantitation as a means of identifying enriched proteins above background. In conventional affinity proteomics this practice is typically applied to experiments that seek a specific target- either through immunoprecipitation via native epitopes or by catching affinity tags. Generally, the 'beadome' is considered a consistent, and similarly quantifiable, background against which differentially enriched targets can be found.
Functions
jwrangle.MQ_poolDataByCondition( )
jvis.BoxPlotByColumn_sbplot( )
Next we will compare intensity and sequence coverage between groups. Log2 transformation has already been performed so we need only use jwrangle.MQ_poolDataByCondition( ) to create the appropriate long form dataset for plotting with jvis.BoxPlotByColumn_sbplot( ).
#### Pool data into a single long form dataset
pooled_dfDropGroupOne = jwrangle.MQ_poolDataByCondition(pGroup_log2, metadata_sort, prefix_list = ['Intensity', 'Sequence coverage'])
#### Compare Intensity distribution using a box and whisker plot
sns.set_style('whitegrid')
jvis.BoxPlotByColumn_sbplot(pooled_dfDropGroupOne, 'Intensity: ', 'Intensity')
#### Compare Sequence coverage using a box and whisker plot
sns.set_style('whitegrid')
jvis.BoxPlotByColumn_sbplot(pooled_dfDropGroupOne, 'Sequence coverage: ', 'Sequence coverage %')
These results are consistent with expectations.
Functions
jinspect.MQ_getSumBySample( )
jvis.BarPlotByGroup_sbplot( )
To sum the total peptides observed across all proteins use _jinspect.MQgetSumBySample( ). These sums will be returned as a modified metadata table.
Plotting these by group is easily done with jvis.BarPlotByGroup_sbplot( ). The plotting order is determined by the metadata ordering.
In this case we are inspecting the number of peptides detected after having removed contaminants- thus if some spike-in proteins were removed, i.e. in this case RNAse treatments, they will not contribute to the peptide count. To look at the replicability of these spike-ins, we would reach back to the 'df_droprows' table generated by jinspect.MQ_dropDuplicateIDs( ) in section 7.
#### Extract the total peptides observed per sample
metaStats = jinspect.MQ_getSumBySample(pGroup_log2, metadata_sort, freqList = ['Peptides'], measure = False)
metaStats
#### Plot the sum peptides
sns.set_style('whitegrid')
jvis.BarPlotByGroup_sbplot(metaStats, x_col = 'condition', y_col = 'Peptides', title = 'Sum Peptides vs Silica Capture', pal = set2_paired, errorbars = 'SEM')
Clearly the cCL sample retrieves the most protein.
Functions
jinspect.MQ_getFrequencyBySample( )
One gene can encode for many proteins that often share regions of similarity. As for illumina-based RNA-Seq, however, shotgun proteomics can rarely assign a peptide species to a singular protein. In MaxQuant these are called proteinGroups. Because we have do not require protein-specific results, and gene identity is more stable, our gene count describes the groups to which our detected proteins have been be assigned. Thus gene here is being detected by protein product, just as it would be detected by RNA product in RNA Seq; none of these 3 are synonymous. To be clear, this is a count and not a measure.
Gene frequency is defined by the summed observations per protein regardless of intensity value and this data is extracted to our modified metadata with jinspect.MQ_getFrequencyBySample( ) .
A typical MQ search will yield identical protein counts (though different values) for Intensity and iBAQ*. LFQ frequencies will vary depending on the search settings:
Notes
* Why protein counts should be identical I don't know. The original iBAQ paper stipulates rules for the inclusion of a protein in the iBAQ calculation but MaxQuant doesn't seem to apply them.
** Previously I tested LFQ min ratio at 1 peptide. At 1 minimum peptide there was unexpected QC clustering. Possible explanations for this are explained in section 7 and are cleaned up by jinspect.MQ_dropDuplicateIDs( ) function. We can expect this function to greatly reduce qualifying IDs (~20% fewer), especially in the QE samples, but I think the trade-off is worth it because we gain 1) a more robust ID check and 2) the same search can be used for LFQ based checks of dynamic changes, i.e. comparing more than one group of cCL captures for biological changes.
#### Count the number of unique
metaStats = jinspect.MQ_getFrequencyBySample(pGroup_log2, metaStats, freqList = ['Intensity', 'iBAQ', 'LFQ intensity'], measure = False)
metaStats
#### Plot the counts
sns.set_style('whitegrid')
jvis.BarPlotByGroup_sbplot(metaStats, x_col = 'condition', y_col = 'Intensity', title = '# Genes Detected By Group', pal = set2_paired, ylabel = 'Unique Genes', errorbars = 'SEM')
It is clear that the nCL and cCL samples are very different both in intensity, peptide count, and unique gene count. When samples are normalised they are, as a pool, each drawn towards overall quantitive agreement as a means of flattening out technical variability. The aggressiveness of this process can have the side-effect of making true variability less apparent. This is a challenging task that is aided by the presence on some level of ratio-wise stable variation between samples because such 'background' will reduce the incidence with which true variability is improperly adjusted. Generally speaking, most normalisation algorithms can tolerate up to 30% quantitative difference- a limit that is exceeded by RIC capture. Thence, it's application is not without some problems. This topic, specifically within the MS-proteomics context, is discussed more thoroughly in my thesis.
Functions
jwrangle.MQ_getSliceByPrefix( )
jvis.showPearsonRegression_altair( )
The function _jwrangle.MQgetSliceByPrefix( ) provides a convenient means of extracting values of a specific group.
We can then use _jvis.showPearsonRegressionaltair( ) to perform pairwise comparisons between each member of those groups. This function is specifically applied to genes with shared intensities- genes exclusive to one sample or the other, represented by vertical or horizontal datapoints, are plotted but excluded from the pearson calculation.
#### Extract the intensity values as a dictionary where keys = groups
Intensity_Dict = jwrangle.MQ_getSliceByPrefix(pGroup_log2, metadata, 'Intensity', group = 'condition', add_col = None)
Intensity_Dict.keys()
#### Check replicate consistency across all within group pairs
jvis.showPearsonRegression_altair(Intensity_Dict['nCL'], mark_color = set2_paired[2])
jvis.showPearsonRegression_altair(Intensity_Dict['254'], mark_color = set2_paired[4])
Replicates look good among both nCL and 254nm cCL samples.
Functions
jinspect.MQ_getFrequencyByGroup( )
jinspect.MQ_filterValidValues( )
jvis.MQ_showImputationHistogram_mpl( )
A conventional T-Test analysis can be applied to find our significantly enriched RBPs. The function jinspect.MQ_getFrequencyByGroup( ) will allow us to tally the number of observations being made per protein group, per sample. Using this information jinspect.MQ_filterValidValues( ) then allows us to discard proteinGroups that do not meet a minimum number of real observations. This limit is user-defined, but a common practice is to include species which were observed >70% of each pool. Missing values are commonly imputed by random distribution, with the intention of achieving higher statistical power. An imputation option is included in the same function and the impute values, once extracted can be plotted with jvis.MQ_showImputationHistogram_mpl( ).
#### Use the metadata and proteinGroups tables to count how many times a gene is identified in its group (/6).
#### Here I demonstrate how we can count for all instances of Intensity, iBAQ and LFQ Intensity
pGroup_Freq = jinspect.MQ_getFrequencyByGroup(pGroup_log2, metadata, 'iBAQ', group = 'condition')
pGroup_Freq = jinspect.MQ_getFrequencyByGroup(pGroup_Freq, metadata, 'LFQ intensity', group = 'condition')
pGroup_Freq = jinspect.MQ_getFrequencyByGroup(pGroup_Freq, metadata, 'Intensity', group = 'condition')
#### Filter the dataset for valid values and generate an imputed variant
RIC_preImpute = jinspect.MQ_filterValidValues(pGroup_Freq, prefix = 'LFQ intensity', group_filter = {'nCL':0, '254':4},
sample_list = metadata['sample'], rship = 'equal or more', impute = False,
keep_cols = ['Majority protein IDs', 'ENTREZGENE_gPro primary', 'ENTREZGENE_gPro name', 'UNIPROT_gPro status'])
RIC_postImpute = jinspect.MQ_filterValidValues(pGroup_Freq, prefix = 'LFQ intensity', group_filter = {'nCL':0, '254':4},
sample_list = metadata['sample'], rship = 'equal or more', impute = True,
keep_cols = ['Majority protein IDs', 'ENTREZGENE_gPro primary', 'ENTREZGENE_gPro name', 'UNIPROT_gPro status'])
#### To review the extent and distribution of imputation in our dataframe
#### First calculate the imputed values by finding the difference between the pre and postimpute dataframes
RIC_imputed = RIC_postImpute[~RIC_postImpute.isin(RIC_preImpute)]
#### Then plot
jvis.MQ_showImputationHistogram_mpl(RIC_postImpute, RIC_imputed, prefix = 'LFQ intensity', sample_list = metadata['sample'], title = 'Imputation Distribution')
Well as good as any imputation can be. Its worked, and the bulk of the imputed values fall in the lower intensity range.
Function
jtest.applyIndependentTTest_ImputeCheck( )
Once a complete dataframe is generated it is ready for T-Testing. The function jtest.applyIndependentTTest_ImputeCheck( ) will perform our T-Test, apply FDR, calculate fold-changes, and assess the dependency of each p-val on imputation and create datapoints for volcano plotting. It is desirable to assess significance with respect to imputation dependency because it allows us to discriminate real values from what are essentially very loosely modeled (I would label fictional) values. Thus a number of calculations into a single output:
#### Calculate enrichment statistics
RIC_tTest = jtest.applyIndependentTTest_ImputeCheck(RIC_preImpute, RIC_postImpute, 'nCL', '254', 'LFQ intensity', metadata)
RIC_tTest[[i for i in list(RIC_tTest.columns) if 'LFQ intensity' not in i]].head(2)
#### Save the table locally
RIC_tTest.to_csv('e299_RIC_tTest.csv', index = False)
#### We can use this table to follow up with a simple volcano plot
sns.set_style('darkgrid', {'axes.grid' : True})
plt.figure(figsize = (10,8))
ax = sns.scatterplot(data=RIC_tTest, legend = 'brief',
x="Log2FC 254", y="-Log(BH FDR p-val)",
hue='Impute Dependency (BH)', palette = cpal['Set2_qual'][:2], s=60, edgecolor = 'black', linewidth = 0.2)
ax = plt.axhline(y = 1.3, xmin = 0, xmax = 1, color = 'black', linestyle = '--', linewidth = 1)
ax = plt.axvline(x = 1.585, ymin = 0, ymax = 1, color = 'black', linestyle = '--', linewidth = 1 )
ax = plt.axvline(x = -1.585, ymin = 0, ymax = 1, color = 'black', linestyle = '--', linewidth = 1 )
plt.legend(loc = 'best', frameon = False)
#### Or with a more complex, interactive volcano plot
source = RIC_tTest
source['ENTREZ name'] = source['ENTREZGENE_gPro name'].apply(lambda x: x.split(' [S')[0])
source['y'] = 1.3
source['x0'] = 1.585
source['x1'] = -1.585
# Brush for selection
brush = alt.selection(type='interval')
# Scatter Plot
points = alt.Chart(source).mark_point().encode(
x='Log2FC 254:Q',
y='-Log(BH FDR p-val):Q',
color=alt.condition(brush, 'Impute Dependency (BH):N', alt.value('grey')
),tooltip=['ENTREZGENE_gPro primary:N', 'ENTREZ name:N']
).add_selection(brush).properties(width=800, height=500
).properties(title = 'placeholder')
c2 = alt.Chart(source).mark_rule(strokeWidth=0.5, strokeDash=[3]).encode(y='y:Q')
c3 = alt.Chart(source).mark_rule(strokeWidth=0.5, strokeDash=[3]).encode(x='x1:Q')
c4 = alt.Chart(source).mark_rule(strokeWidth=0.5, strokeDash=[3]).encode(x='x0:Q')
# Base chart for data tables
ranked_text = alt.Chart(source).mark_text().encode(
y=alt.Y('row_number:O',axis=None)
).transform_window(
row_number='row_number()'
).transform_filter(
brush
).transform_window(
rank='rank(row_number)'
).transform_filter(
alt.datum.rank<27
)
# Data Tables
primary = ranked_text.encode(text='ENTREZGENE_gPro primary:N').properties(title='Gene')
name = ranked_text.encode(text='ENTREZ name:N').properties(title='Name')
status = ranked_text.encode(text='UNIPROT_gPro status:N').properties(title='Status')
text = alt.hconcat(primary, name, status) # Combine data tables
# Build chart
alt.hconcat(
points + c2 + c3 + c4,
text
).resolve_legend(
color='independent'
)
n=725 genes are identified as coding for RBP. This is consistent with n=4 previous experiments with HeLa and HEK293T cells in both 4SU 365nm crosslinking and 254nm crosslinking. The extent of imputation dependence, however, is quite high in the data.
Given the table output from jtest.applyIndependentTTest_ImputeCheck( ) it is easy to extract the significantly enriched hits. FDR-corrected p values are provided for both the Benjamini-Hochberg method and the q-value method. The user should also select an appropriate fold change cut off; typically I like to choose a 3x cutoff which would be log2(3) = 1.58.
RichList = RIC_tTest[(RIC_tTest['sig (BH FDR p-val)']=='significant') & (RIC_tTest['Log2FC 254'] > 1.58)]['ENTREZGENE_gPro primary']
with open('e299_enriched_ricRBP.txt', 'w') as f:
for item in RichList:
f.write("%s\n" % item)
RichList
RIC can applied to single shot MS identification of RBP via label-free practices with the following characteristics:
For a dissection of the biological characteristics of these hits see previous experiments (i.e. expt.15 and expt.14) or see the original papers by Castello et al. (2012) and Baltz et al. (2012).